<?php
	session_start();
	include("../../dbconnect.inc.php");
	include("functions.inc.php");
	$form = check_form($_POST["edit"]);
	extract($form);
	$id = $_POST["id"];
	$sql = "update  users set ";
	if($form["pass"] != "") {
		$form["pass"] = md5($form["pass"]);
		$sql .= "password='{$pass}', ";
	}	
	$sql .= " sex='{$sex}',";
	$sql .= " mail='{$mail}', ";
	$sql .= " tel='{$tel}', ";
	$sql .= " web='{$web}', ";
	$sql .= " birthday='{$birthday}', ";
	$sql .= " inter='{$inter}', ";
	$sql .= " intro='{$intro}' ";
	$sql .= " where id={$id} ";
	$res = mysql_query($sql);
	if(!$res) {
		echo mysql_error();
		die("DB wrong Please back and try again!");
	}
	
	header("Location:msg.php?m=update_success");
?>